<?php
namespace lightblog\admin\model;

use lightblog\engine\model;

class authorizeModel extends model {

    public function login($username = "", $password = "") {
        if ($username == "" && $password == "") {
            $username = \lightblog::$app->request->parameter->post['name'];
            $password = \lightblog::$app->request->parameter->post['password'];
        }

        $encrypt_pwd = md5($password);
        $pwd = "90365946fd19b0d2d420680843dd1297";

        if ($username == 'sidgwick' && $encrypt_pwd == $pwd) {
            $_SESSION['uid'] = '1';
            $_SESSION['username'] = 'Administrator';
            return true;
        }
        return false;
    }

    public function logout() {
        return session_destroy();
    }
}
